home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com
- Newsgroups: comp.lang.c++
- Subject: Re: cin.get() function challenge
- Date: 27 Jan 1996 16:45:24 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4edkr4$2mb@news1.usa.pipeline.com>
- NNTP-Posting-Host: pipe11.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Jan 26, 1996 16:27:40 in article <cin.get() function challenge>,
- 'wsenn@cencom.net (Will Senn)' wrote:
-
- >Alrighty then!
- >
- >Some of you may recall my post of a week ago asking for help on getch()
- and
- >cin. The responses I received were not encouraging.
- >
- >The problem:
- > Write a function in C++ not using getch() that will read in ONE
- >character at a time, without line buffering. In other words when the user
-
- >presses ONE key, take and process that keypress. I had originally asked
- if
- >it was possible to use cin or another iostream for this purpose. It would
- be
- >nice if someone could definitively address this question.
- >
- >The most common reply I received and one the authors claimed would relieve
- all
- >my problems, while implying I should read the BOOK was the following:
- >
- ... [code deleted]...
-
- >
- >This is a piece of code that these 'programmers' obviously read in a BOOK,
-
- >it doesn't even come close to addressing my question. If they had
- finished
- >the chapter they were reading they might have noticed that the get()
- member
- >function of cin is ALWAYS line buffered! Another way they might have
- realized
- >that their answer was wrong would have been to COMPILE it.
- >
- >If someone out there has a grip on this rather complex issue, I would
- very
- >much appreciate a reply, by mail or post.
- >
- I don't know whether you chose to ignore all the correct responses
- to your question or is your newsreader malfunctioning. I saw at
- least three responses of the nature "it isn't possible with standard
- iostream library as reading keystrokes directly is dependent on the
- OS and/or the compiler system you're using".
- Those answers were more or less correct.
-
- I could offer a solution for a specific platform, but if I recall
- correctly, in your original post you already stated that you
- were already aware of conio or curses library functions that
- will do what you want.
-
- --
- Pete Grant
- Kalevi, Inc.
- Object Oriented Software Development
-